// src/logical/auth/auth.module.ts
import { Module } from '@nestjs/common';
import { JwtStrategy } from './jwt.strategy';
import { AccountModule } from '../account/account.module';
import { JwtModule } from '@nestjs/jwt';
import { jwtConstants } from './constants';
import { AuthService } from './service/auth.service';
import { AuthController } from './controller/auth.controller';
import { LoginLogModule } from '../login-log/login-log.module';
import { LoginLogProviders } from '../login-log/provider/loginLog.providers';
import { DatabaseModule } from 'src/database/database.module';
import { RoleService } from '../role/service/role.service';
import { RoleProviders } from '../role/providers/role.providers';
import { SequelizeModule } from '@nestjs/sequelize';
import { RoleEntity } from '../role/entity/role.entity';

@Module({
  imports: [
    DatabaseModule,
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: jwtConstants.expiresSecond }, // token 过期时效
    }),
    AccountModule,
    LoginLogModule,
    SequelizeModule.forFeature([RoleEntity]),
  ],
  providers: [
    AuthService,
    RoleService,
    JwtStrategy,
    ...LoginLogProviders,
    ...RoleProviders,
  ],
  exports: [AuthService],
  controllers: [AuthController],
})
export class AuthModule {}
